package com.gitee.wsl.compose.mvi.component

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.gitee.wsl.compose.mvi.component.base.Interactable
import com.gitee.wsl.compose.mvi.component.base.Presentable

abstract class Projector<Interactor, Presenter>(
    override val interactor: Interactor,
    override val presenter: Presenter
) : Projectable<Interactor, Presenter> where Interactor : Interactable, Presenter : Presentable<Presenter> {

    @Composable
    abstract fun body(combinedModifier: Modifier, interactor:Interactor, presenter:Presenter)


    @Composable
    operator fun invoke(modifier: Modifier = Modifier) = contextualize(modifier){ combinedModifier, interactor, presenter ->
        body(combinedModifier,interactor,presenter)
    }
}